﻿Type.registerNamespace("BM");

BM.NodeBuilder = {
    createDiv: function(parent, className) {
        var div = document.createElement("div");
        if (parent != null) {
            parent.appendChild(div);
        }
        if (className != null) {
            div.className = className;
        }
        return div;
    },

    createSpan: function(parent, className, text) {
        var span = document.createElement("span");
        if (parent != null) {
            parent.appendChild(span);
        }
        if (className != null) {
            span.className = className;
        }
        if (text != null) {
            BM.NodeBuilder.appendText(span, text);
        }
        return span;
    },

    appendText: function(node, text) {
        node.appendChild(document.createTextNode(text));
    }
}